import request from "@/utils/request";

const BASE_URL = "/payment";

class PaymentSplitAPI {
  /** 获取分账开户审核分页数据 */
  static getSplitApprovalList(queryParams?: any) {
    return request<any, PaymentSplitVO>({
      url: `${BASE_URL}/split/list`,
      method: "get",
      params: queryParams,
    });
  }

  /** 获取分账分页数据 */
  static getSplitList(queryParams?: any) {
    return request<any, PaymentSplitVO>({
      url: `${BASE_URL}/separate/list`,
      method: "get",
      params: queryParams,
    });
  }

  /**
   * 获取开通分账详情
   * @param merCupNo
   * @returns
   */
  static getSplitGate(merCupNo: string) {
    return request<any, PageResult<PaymentSplitVO[]>>({
      url: `${BASE_URL}/split/get`,
      method: "get",
      params: { merCupNo },
    });
  }
  /**
   * 新增开通分账
   * @param data
   * @returns
   */
  static addSplitGate(data: PaymentSplitVO) {
    return request<any, any>({
      url: `${BASE_URL}/split/add`,
      method: "post",
      data,
    });
  }
  /**
   * 更新开通分账
   * @param data
   * @returns
   */
  static updateSplitGate(data: PaymentSplitVO) {
    return request<any, any>({
      url: `${BASE_URL}/split/update`,
      method: "post",
      data,
    });
  }

  /**
   * 获取分账绑定详情
   * @param subMerchantId
   * @returns
   */
  static getBindDetail(subMerchantId?: string) {
    return request<any, any>({
      url: `${BASE_URL}/submerchant/receiver/getYqPaymentSubMerchantReceiverDO`,
      method: "get",
      params: { subMerchantId },
    });
  }

  static bind(data: any) {
    return request<any, any>({
      url: `${BASE_URL}/submerchant/receiver/add`,
      method: "post",
      data,
    });
  }

  static getReceiverList(queryParams?: any) {
    return request<any, PageResult<ReceiverVO[]>>({
      url: `${BASE_URL}/receiver/list`,
      method: "get",
      params: queryParams,
    });
  }

  static getReceiverOptions(queryParams?: any) {
    return request<any, PageResult<ReceiverVO[]>>({
      url: `${BASE_URL}/receiver/getList`,
      method: "get",
      params: queryParams,
    });
  }

  /**
   * 新增开通分账
   * @param data
   * @returns
   */
  static addReceiver(data: ReceiverVO) {
    return request<any, any>({
      url: `${BASE_URL}/receiver/add`,
      method: "post",
      data,
    });
  }
  /**
   * 更新开通分账
   * @param data
   * @returns
   */
  static updateReceiver(data: ReceiverVO) {
    return request<any, any>({
      url: `${BASE_URL}/receiver/update`,
      method: "post",
      data,
    });
  }

  /**
   * 获取分账绑定详情
   * @param id
   * @returns
   */
  static getReceiverDetail(id: string) {
    return request<any, any>({
      url: `${BASE_URL}/receiver/get`,
      method: "get",
      params: { id },
    });
  }
}

export default PaymentSplitAPI;

export interface PaymentSplitVO {
  //
  id?: number;
  //银联商户号
  merCupNo?: string;
  //联系手机号
  contactMobile?: string;
  //最低分账比例
  splitLowestRatio?: number;
  //分账结算委托书文件名称
  entrustFileName?: string;
  //分账结算委托书文件
  entrustFile?: string;
  //调用商户入网接口上传附件后反馈的文件路径
  attFileId?: string;
  //审核状态:0-待审核,1-审核通过,2-审核驳回
  reviewStatus?: number;
  //审核驳回原因
  rejectReason?: string;
}

export interface ReceiverVO {
  id?: number;
  //接收方编号
  receiverNo?: string;
  //分账接收方名称
  name?: string;
  //分账状态 0禁用，1启用
  status?: number;
  //联系手机号
  contactMobile?: string;
  //收款账户账户类型，57对公 58对私
  acctTypeCode?: string;
  //收款账户卡号
  acctNo?: string;
  //收款账户名称
  acctName?: string;
  //收款账户证件类型，17身份证 18护照 19港澳通行证 20台胞证
  acctCertificateType?: string;
  //收款账户证件号
  acctCertificateNo?: string;
  //营业执照号码
  licenseNo?: string;
  //营业执照名称
  licenseName?: string;
  //法人姓名
  legalPersonName?: string;
  //法人证件类型
  legalPersonCertificateType?: string;
  //法人证件号
  legalPersonCertificateNo?: string;
  //收款账户开户行号，仅支持对私结算账户
  acctOpenBankCode?: string;
  //收款账户开户名称
  acctOpenBankName?: string;
  //收款账户清算行行号，仅支持对私结算账户
  acctClearBankCode?: string;
  //法人身份证正面照片-----路径
  idFrontPic?: string;
  //法人身份证正面照片----名称
  idFrontPicFileName?: string;
  //法人身份证正面照片----拉拉卡返回路径
  idFrontPicAttFileId?: string;
  //法人身份证反面照片
  idBehindPic?: string;
  //法人身份证反面照片
  idBehindPicFileName?: string;
  //法人身份证反面照片
  idBehindPicAttFileId?: string;
  //银行卡照片
  bankCardPic?: string;
  //银行卡照片
  bankCardPicFileName?: string;
  //银行卡照片
  bankCardPicAttFileId?: string;
  //营业执照照片
  businessLicencePic?: string;
  //营业执照照片
  businessLicencePicFileName?: string;
  //营业执照照片
  businessLicencePicAttFileId?: string;
  //创建时间
  createdAt?: string;
  //更新时间
  updatedAt?: string;
}
